package com.smarth.zhizulian.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.smarth.zhizulian.R;
import com.smarth.zhizulian.bean.Disciple;
import com.smarth.zhizulian.utils.GlideUtils;
import com.smarth.zhizulian.utils.ViewHolder;

import java.util.List;

/**
 * Created by 18865 on 2017/12/25.
 */

public class NewMyDiscipleAdapter extends BaseObjectListAdapter {
    public NewMyDiscipleAdapter(Context context, List<? extends Object> datas) {
        super(context, datas);
    }

    @Override
    public View getItemView(int position, View convertView, ViewGroup parent) {
        convertView = getConvertView(convertView, R.layout.item_newmyapprentice);
        ImageView iv_avatar = ViewHolder.get(convertView, R.id.iv_avatar);
        TextView tv_name = ViewHolder.get(convertView, R.id.tv_name);
        TextView tv_coin = ViewHolder.get(convertView, R.id.tv_coin);
        TextView tv_activeuser = ViewHolder.get(convertView, R.id.tv_activeuser);
        TextView tv_time = ViewHolder.get(convertView, R.id.tv_time);
        Disciple d = (Disciple) mDatas.get(position);
        GlideUtils.loadAvatar(mContext, d.getAvatar(), iv_avatar);
        tv_name.setText(d.getNickname());
        tv_coin.setText("" + d.getCoin() + "金币");
        tv_activeuser.setText(d.getIsActivate() == 1 ? "有效用户" : "待激活用户");
        tv_activeuser.setSelected(d.getIsActivate() == 1);
        tv_time.setText(d.getCreateTime());
        return convertView;
    }
}
